package com.yanqu.road.dao.impl.servercenter;

import com.yanqu.road.dao.db.DbNameStrategy;
import com.yanqu.road.dao.impl.TempDao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

public class WhiteWordDaoImpl extends TempDao {

	public List<String> getWhiteWordList(int channelId) {
		ResultSet rs = null;
		PreparedStatement call = null;
		String sql = "select * from t_s_chat_white_word where channelId=?";
		List<String> dataList = new ArrayList<>();
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setLong(1, channelId);
			rs = call.executeQuery();
			while (rs.next()) {
				String content =  rs.getString("content");
				dataList.add(content);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataList;
	}
}
